package ui.face {

	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormatAlign;
	
	import globals.Global;
	import globals.Setting;
	
	import ui.component.Label;
	import ui.panel.PanelType;
	
	import util.DisplayUtil;
	
	public class IconFace extends Sprite {
		
		public var map:FaceIconItem;
		public var item:FaceIconItem;
		public var castle:FaceIconItem;
		private var castleNum:Label;

		public function IconFace() {
			super();
			
			castle = new FaceIconItem(new Bitmap(Global.assetsManager.getAssetsAsBitmapData("face_tr")));
			castle.handler = castleHandler;
			addChild(castle);
			
			castleNum = new Label(14, 0xFFFFFF, false, TextFormatAlign.CENTER, true);
			castleNum.x = 25;
			castleNum.y = 20;
			addChild(castleNum);
			
			map = new FaceIconItem(new Bitmap(Global.assetsManager.getAssetsAsBitmapData("face_i2")));
			map.handler = mapHandler;
			map.y = 350;
			addChild(map);
			
			item = new FaceIconItem(new Bitmap(Global.assetsManager.getAssetsAsBitmapData("face_i3")));
			item.handler = itemHandler;
			item.y = 400;
			addChild(item);
			
			updateCastleNumber(25);
		}
		
		private function castleHandler():void {
			trace("click castle");
		}
		
		private function taskHandler():void {
			trace("click task");
			Global.uiManager.openPanel(PanelType.WARRIOR_PANEL);
		}
		
		private function mapHandler():void {
			trace("click map");
		}
		
		private function itemHandler():void {
			trace("click item");
		}
		
		public function updateCastleNumber(count:uint):void {
			castleNum.text = count.toString();
		}
	}
}